package main

import (
	"net/rpc/jsonrpc"
	"gitee.com/Fanghr/FuckRPC_DataStructure"
	"log"
)

const port string = ":8989"

func main() {
	service := "127.0.0.1" + port
	client, err := jsonrpc.Dial("tcp", service)
	if err != nil {
		log.Panicln("dial error:", err)
	}

	args := RPCDataStructure.Args{200, 50}
	var reply int
	log.Println("Call Arith.Multiply with Args:", args)
	err = client.Call("Arith.Multiply", args, &reply)
	if err != nil {
		log.Panicln("Arith.Multiply call error:", err)
	}
	log.Println("Arith.multiply reply:", reply)

	log.Println("Call Arith.Divide with Args:", args)
	err = client.Call("Arith.Divide", args, &reply)
	if err != nil {
		log.Panicln("Arith.Divide call error:", err)
	}
	log.Println("Arith.devide reply:", reply)
}
